<?php

namespace App\Enums\Notification;

use App\NotificationActions\CartClear;
use App\NotificationActions\NotificationActionInterface;

enum CounterApply : string implements NotificationEnumInterface
{
    // 订单退款
    case OrderRefund = 'order_refund';

    // 购物车清空
    case CartClear = 'cart_clear';

    // 手动开钱箱
    case OpenCashBox = 'open_cash_box';

    // 挂单
    case HangUp = 'hang_up';

    // 修改桌台时长
    case EditTableTime = 'edit_table_time';

    // 敏感操作
    case SensitiveOperation = 'sensitive_operation';

    // 赠送商品
    case GiftGoods = 'gift_goods';

    public function label()
    {
        return match ($this) {
            self::OrderRefund => '订单退款',
            self::CartClear => '购物车清空',
            self::OpenCashBox => '手动开钱箱',
            self::HangUp => '挂单',
            self::EditTableTime => '修改桌台时长',
            self::SensitiveOperation => '敏感操作',
            self::GiftGoods => '赠送商品',
        };
    }

    public function action() : NotificationActionInterface|null
    {
        return match ($this) {
            self::OrderRefund => null,
            self::CartClear => new CartClear(),
            self::OpenCashBox => null,
            self::HangUp => null,
            self::EditTableTime => null,
            self::SensitiveOperation => null,
            self::GiftGoods => null,
        };
    }
}
